package com.example.xd.gamedemo.pingtu;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;

import androidx.annotation.Nullable;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.example.xd.gamedemo.R;

import java.util.List;

/**
 * @auther XuDan on 2020/4/15.
 */
public class PingTuAdapter extends BaseQuickAdapter<ImageInfo, BaseViewHolder> {
    private Context context;

    public PingTuAdapter(Context context, int layoutResId, @Nullable List<ImageInfo> data) {
        super(layoutResId, data);
        this.context = context;
    }

    @Override
    protected void convert(BaseViewHolder helper, ImageInfo item) {
        ImageView img = helper.getView(R.id.pingtu_item_img);
        FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(item.getBmp_l(), item.getBmp_l());
        img.setLayoutParams(lp);
        Glide.with(context).load(item.getBitmap()).into(img);
    }
}
